package com.biannuo.szk.demo.web;

import com.biannuo.szk.common.base.BaseResource;
import com.biannuo.szk.common.vo.ResponseVO;
import com.biannuo.szk.demo.dao.entity.DemoUser;
import com.biannuo.szk.demo.service.IDemoService;
import com.biannuo.szk.demo.service.dto.DemoUserDTO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 示例业务
 *
 * @author admin
 */
@RestController
@RequestMapping("/demo")
public class MybatisDemoUserController extends BaseResource {

    @Autowired
    private IDemoService mybatisDemoService;

    @RequestMapping("/findAll")
    public ResponseVO<List<DemoUser>> findAll() {
        ResponseVO responseVO = buildSuccess(mybatisDemoService.findAll());
        return responseVO;
    }

    @RequestMapping("/getOne")
    public ResponseVO<String> getOne() {
        DemoUserDTO mybatisDemoUserDto = DemoUserDTO.builder().id(34124314312L).username("张三").password("123456").build();
        return buildSuccess(mybatisDemoUserDto);
    }

}